package com.wetao.lib_common.tsdBlePen;

public class TsdPenUtil {
    private static  float DOT_PW = 5600F;
    private static  float DOT_PH = 7920F;
    /*private static  float DX = 20F;
    private static  float DY = 13F;*/
    private static  float DX = 0F;
    private static  float DY = 0F;

    public static  float getRealX(float x, int pic_w) {
        DOT_PW = getT(pic_w);
        x = x >= DOT_PW ? DOT_PW : x;
        return x * pic_w / DOT_PW - DX;
    }
    public static  float getRealY(float y, int pic_h) {
        DOT_PH = getT(pic_h);
        y = y >= DOT_PH ? DOT_PH : y;
        return y * pic_h / DOT_PH - DY;
    }

    private static float getT(int pic) {
        //return pic / 118.11f * 10 / 0.3f * 8 * 2;
        return pic / 118.11f * 10 / 0.3f * 8;
    }

    //图片格子坐标转成纸上的dot坐标
    public static float picToDotX(float x, int pic_w) {
        return x * getT(pic_w) / pic_w;
    }

    public static float picToDotY(float y, int pic_h) {
        return y * getT(pic_h) / pic_h;
    }
}
